<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<!-- SVN FILE: $Id: template.php 8 2011-03-13 08:32:38Z michele.andreoletti@gmail.com $ -->
	
	<!--		
	Project Name : arcadia

	@author $Author: michele.andreoletti@gmail.com $
	@version $Revision: 8 $
	@lastrevision $Date: 2011-03-13 08:32:38 +0000 (Sun, 13 Mar 2011) $
	@filesource $URL: http://arcadia.googlecode.com/svn/trunk/themes/default/template.php $
	-->

	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />

		<title><?php echo $sHeaderTitle; ?></title>

		<link href='<?php echo $sSCRIPT_ROOT_PATH ?>/themes/common/images/<?php echo $sFAVICON; ?>' rel='shortcut icon'/>

		<script type="text/javascript" src="<?php echo $sSCRIPT_ROOT_PATH ?>/include/jquery-ui/js/jquery-1.4.4.min.js"></script>

		<script type="text/javascript" src="<?php echo $sSCRIPT_ROOT_PATH ?>/themes/<?php echo $sTHEME; ?>/js/menu.js"></script>
		<link type="text/css" href="<?php echo $sSCRIPT_ROOT_PATH ?>/themes/<?php echo $sTHEME; ?>/stylesheets/menu.css" rel="stylesheet" />

		<script type="text/javascript" src="<?php echo $sSCRIPT_ROOT_PATH ?>/include/jquery-ui/js/jquery-ui-1.8.7.custom.min.js"></script>
		<script type="text/javascript" src="<?php echo $sSCRIPT_ROOT_PATH ?>/include/jquery-ui/js/i18n/jquery-ui-i18n.min.js"></script>
		<link type="text/css" href="<?php echo $sSCRIPT_ROOT_PATH ?>/include/jquery-ui/css/redmond/jquery-ui-1.8.7.custom.css" rel="stylesheet" />

		<?php if (isset($bSEARCH_FORM_SHOW) && $bSEARCH_FORM_SHOW && isset($sOpenSearchXML)) echo $sOpenSearchXML; ?>

		<?php if (isset($sHeadContent)) { echo $sHeadContent; } ?>
		
		<!-- lascio i fogli di stile del template per ultimi perchè contengono 'personalizzazioni' rispetto al css di DataTables -->
		<link type="text/css" href="<?php echo $sSCRIPT_ROOT_PATH ?>/themes/<?php echo $sTHEME; ?>/stylesheets/screen.css" rel="stylesheet" />
		<link type="text/css" href="<?php echo $sSCRIPT_ROOT_PATH ?>/themes/<?php echo $sTHEME; ?>/stylesheets/print.css" rel="stylesheet" media="print" />

	</head>

	
	<body>

		<div id="menu">
			<ul class="menu">
				<li><a href="#"><span><?php echo fnReadSessionValue('sDisplayname'); ?></span></a></li>
				
				<li><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/index.php" class='parent'><span>Applicazioni</span></a>
					<div><ul>
						<?php echo fnSuiteAppsLinks('menu'); ?>
					</ul></div>
				</li>
				
				<?php if ((isset($iAccessLvl) && is_allowed('edit', $iAccessLvl)) || is_allowed('sysop'))  { ?>
					
					<li><a href='#' class='parent'><span>Strumenti</span></a>
						<div><ul>
							
							<?php if (isset($sAPP)) { echo fnMenuResourcesLinks($sAPP); } ?>
							
							<?php if (is_allowed('sysop'))  { ?>
								<li><a href="#" class='parent'><span>Utenti & Gruppi</span></a>
									<ul>
										<li><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/sysop/index.php?sType=user"><span>Gestione Utenti</span></a></li>
										<li><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/sysop/index.php?sType=group"><span>Gestione Gruppi</span></a></li>
									</ul>
								</li>
								<li><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/sysop/log.php"><span>Gestione Log</span></a></li>
								<li><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/phpMyAdmin" target="_mysql"><span>phpMyAdmin</a></li>
								<li><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/sysop/phpinfo.php" target="_info"><span>phpinfo()</span></a></li>
							<?php 	}	?>
							
						</ul></div>
					</li>
					
				<?php 	}	?>
				
				<li><a href='#' class='parent'><span>Collegamenti</span></a>
					<div><ul>
						<li><a href="http://172.18.55.2:8080/AssetPlusWeb/" target="_asset"><span>AssetPlus WEB</span></a></li>
						<li><a href="http://oracolo/qualit/" target="_new"><span>Procedure Generali AO</span></a></li>
					</ul></div>
				</li>				
				
				<li class="last"><a href="<?php echo $sSCRIPT_ROOT_PATH ?>/login.php?iLogoff=1"><span>Uscita</span></a></li>
			</ul>
		</div>


		<table class="template-layout-grid" cellspacing="0" cellpadding="0">
			<tr>
				<td class="template-left-nav">

						<?php if (isset($sLEFT_NAV_IMG) && $sLEFT_NAV_IMG!='')  { ?>
								<img src="<?php echo $sSCRIPT_ROOT_PATH ?>/themes/<?php echo $sTHEME; ?>/images/<?php echo $sLEFT_NAV_IMG ?>" width="100px" height="100px" style="margin-left: 35px; margin-top: 20px;" />
						<?php 	}	?>

					<dl class="template-links-nav">

						<?php if (isset($bSEARCH_FORM_SHOW) && $bSEARCH_FORM_SHOW)  {
								echo $sHtmlSearchForm;
								}	?>

						<?php
							if (isset($sSidebar) && !empty($sSidebar))  {
								echo (isset($sSidebarTitle) && !empty($sSidebarTitle) ? "<dt>$sSidebarTitle</dt>" : "<br/>" );
								echo $sSidebar;
							 }	?>

						<?php
							if (isset($sSidebarActions) && !empty($sSidebarActions))  {
								if (isset($sSidebarActionsTitle) && !empty($sSidebarActionsTitle))
									echo "<dt>$sSidebarActionsTitle</dt>";
								echo $sSidebarActions;
							 }	?>

						<?php
							if (isset($sSidebarTags) && !empty($sSidebarTags))  {
								if (isset($sSidebarTagsTitle) && !empty($sSidebarTagsTitle))
									echo "<dt>$sSidebarTagsTitle</dt>";
								echo $sSidebarTags;
							 }	?>


					</dl>
				</td>
				<td class="template-normal">

						 <?php if (isset($sMessageFlash)) echo "<div class='jquery-message'>$sMessageFlash</div>"; ?>

						<h4 class="template-table-subheader"><?php echo $sAPP_NAME; ?></h4>
						<h3 class="template-table-title"><?php echo $sTableTitle; ?></h3>

						<?php if (isset($sNewItem) && !empty($sNewItem)) { echo "<div class='template-new-item'>".$sNewItem."</div>"; } ?>

						<?php echo $html; ?>
						
						
						<div class="template-copyright">
							<?php if (isset($sSUITE_COPYRIGHT)) echo $sSUITE_COPYRIGHT; ?><a href="http://apycom.com/"></a>
						</div>

				</td>
			</tr>
		</table>


		<!-- INFO per DEBUG -->
		
		<?php if ((isset($iAccessLvl) && fnShowDebugMsg(true, $iAccessLvl)) || fnShowDebugMsg()) {
			/*
			 * Nel primo caso l'utente può visualizzare i messaggi di errore se è un sysop per
			 * l'applicazione che è in esecuzione.
			 * Nel secondo caso i messaggi di errore vengono visualizzati solo dal sysop 'globale',
			 * ad esempio per visualizzare i messaggi nella dashboard
			 *
			 */ ?>
			 
			<div class='template-debug'>
			<?php 	
				echo "<div class='template-debug-header'>Login: <strong>".fnReadSessionValue('sUsername')."</strong>".
					(isset($sAPP) ? " - Access Lvl [$sAPP]: <strong>".fnGetAppAccessLvl($sAPP)."</strong>" : '').
					(isset($sTable) && !is_null(fnReadSessionValue($sTable, 'AccessLvl', $sAPP, 'table')) ? " - Access Lvl [$sTable]: <strong>".fnReadSessionValue($sTable, 'AccessLvl', $sAPP, 'table')."</strong>" : '').
					"</div>";
				echo "<hr align='left' width='80%' />".print_array($_SESSION)."<hr align='left' width='80%' />";
		 	?>
			</div>
		<?php } ?>

	</body>

</html>




	<?php
	
	/**
	 * print_array()
	 * Does a var_export of the array and returns it between <pre> tags
	 *
	 * @param mixed $var any input you can think of
	 * @return string HTML
	 */
	function print_array($var) {
		$input = var_export($var,true);
		$input = preg_replace("! => \n\W+ array \(!Uims", " => Array ( ", $input);
		$input = preg_replace("!array \(\W+\),!Uims", "Array ( ),", $input);
		return("<pre>".str_replace('><?', '>', highlight_string('<'.'?'.$input, true))."</pre>");
	}

	function fnMenuResourcesLinks ($sApp) {
		global $aRESOURCES_APP, $aRESOURCES;
		$html = '';
		
		if (is_allowed('edit', fnGetAppAccessLvl($sApp)) && isset($aRESOURCES_APP) && !empty($aRESOURCES_APP)) {
			$html .= "<li><a href='#' class='parent'><span>Gestione Risorse</span></a>";
			
			$html .= "<ul>";
				foreach ($aRESOURCES_APP as $sType) {
					if (isset($aRESOURCES[$sType])) {
						$html .= "<li><a href='./resources.php?sType=$sType'><span>".$aRESOURCES[$sType]['sLabel']."</span></a></li>";
					} else { 
						$html .= "<li><a href='#'><span>Errore!</span></a></li>";
					}
				}
			$html .= "</ul>";
			
			$html .= "</li>";
		}
		
		return $html;
	}

	?>
